package com.applozic.mobicomkit.uiwidgets.conversation.adapter;

import android.content.Context;
import android.support.annotation.IdRes;
import android.view.View;

import com.applozic.mobicomkit.uiwidgets.R;
import com.applozic.mobicomkit.uiwidgets.conversation.view.MobicomMultimediaItemView;
import com.lottery.ruok.lottrey.adapter.BaseListAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by reytum on 18/3/16.
 */
public class MobicomMultimediaPopupAdapter extends BaseListAdapter<MobicomMultimediaPopupAdapter.MobicomMultimediaModel> {
    private List list;

    public MobicomMultimediaPopupAdapter(Context context) {
        super(context);
        initData();
        setList(list);
    }

    private void initData() {
        list = new ArrayList();
        list.add(new MobicomMultimediaModel("相册", R.mipmap.pic_chat, MobicomMultimediaModel.TYPE_PHOTO));
        list.add(new MobicomMultimediaModel("拍照", R.mipmap.photo_chat, MobicomMultimediaModel.TYPE_CAMARI));
        list.add(new MobicomMultimediaModel("红包", R.mipmap.money_chat, MobicomMultimediaModel.TYPE_RED_PACKET));
    }

    @Override
    protected View createItemView(Context mContext) {
        return new MobicomMultimediaItemView(mContext);
    }

    @Override
    protected void onBindView(View itemView, int position) {
        if (itemView instanceof MobicomMultimediaItemView) {
            MobicomMultimediaItemView view = (MobicomMultimediaItemView) itemView;
            view.setData(getList().get(position));
        }
    }


    public static class MobicomMultimediaModel {
        public static final int TYPE_PHOTO = 0;
        public static final int TYPE_CAMARI = 1;
        public static final int TYPE_RED_PACKET = 2;
        private String title;
        private int resId;
        private int type;

        public MobicomMultimediaModel(String title, int resId, int type) {
            this.title = title;
            this.resId = resId;
            this.type = type;
        }

        public MobicomMultimediaModel() {
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public int getResId() {
            return resId;
        }

        public void setResId(@IdRes int resId) {
            this.resId = resId;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }
    }

}
